//
//  SpecialProductGoodsCollectionViewCell.m
//  Youhuiju
//
//  Created by 余尚飞 on 16/8/5.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "SpecialProductGoodsCollectionViewCell.h"

@interface SpecialProductGoodsCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *goodsImg;//商品图片
@property (weak, nonatomic) IBOutlet UILabel *sectionLabel;//sectionTitle（全网比价 直降到底）
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;//商品名称
@property (weak, nonatomic) IBOutlet UILabel *saleCountLabel;//打折
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;//价格
@property (weak, nonatomic) IBOutlet UILabel *originalCostLabel;//原价

//适配
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imgHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *sectionLabelHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelLesding;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *titleLabelTrailing;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *priceIconHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *priceIconTop;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *saleCountTop;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *saleCountHeight;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *originalCostLabelHeight;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyButtonBottom;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyButtonTrailing;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyButtonWid;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *buyButtonHig;


@end


@implementation SpecialProductGoodsCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.imgHeight.constant = 145 * FitH;
    self.sectionLabelHeight.constant = 25 * FitH;
    
    self.titleLabelTop.constant = 7 * FitH;
    self.titleLabelLesding.constant = 11 * FitW;
    self.titleLabelTrailing.constant = 11 * FitW;
    self.titleLabel.font = [UIFont systemFontOfSize:13 * FitH];
    
    self.priceIconHeight.constant = 12 * FitH;
    self.priceIconTop.constant = 6 * FitH;
    
    self.saleCountHeight.constant = 9 * FitH;
    self.saleCountTop.constant = 5 * FitH;
    
    self.priceLabel.font = [UIFont systemFontOfSize:12 * FitH];
    self.originalCostLabelHeight.constant = 8 * FitH;
    self.originalCostLabel.font = [UIFont systemFontOfSize:8 * FitH];
    
    self.buyButtonBottom.constant = 10 * FitH;
    self.buyButtonTrailing.constant = 9 * FitW;
    self.buyButtonWid.constant = 30 * FitW;
    self.buyButtonHig.constant = 19 * FitH;
    
    
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:@"¥ 210"];
    
    [attributedString addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, 5)];
    
    self.originalCostLabel.attributedText = attributedString;
    
}

- (IBAction)addShopCartAction:(UIButton *)sender {
    
    [self.CategoryButtonDelegate addShopCart:@"这里需要传一个Model"];
}


@end
